package program.Condition;

import program.Atom;
import program.SExprList;
import program.SExpression;
import Exceptions.IllegalCoordinateException;
import Exceptions.ShootException;
import roborally.Robot;

/**
 * A class representing a condition.
 * 
 * @author Jef Keijers/Bachelor of Science: Informatics
 * @version 1.0
 */
public abstract class Condition {
	
	public abstract boolean execute(Robot robot) throws ShootException, IllegalCoordinateException;
	
	/**
	 * This method returns the SExpression representation of at-item.
	 */
	public abstract SExpression toSExpression();
	
	/**
	 * This method returns an SExpression (SExpressionList) from the given condition string.
	 * @param 	condition	
	 */
	protected SExpression makeSingletonSExpressionList(String condition) {
		SExprList sexpr = new SExprList();
		sexpr.add(new Atom(condition));
		return sexpr;
	}
}
